package com.ly.honor.config;

import com.ly.honor.interceptor.CaptchaInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 李某人
 * @Date 2023/3/21 21:45
 * @Version 1.0
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
    public CaptchaInterceptor captchaInterceptor() {
        return new CaptchaInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //验证码
        registry.addInterceptor(captchaInterceptor())
                .addPathPatterns("/admin/user/login");
    }
}
